﻿@using EasyWeb.Services
@model EWConfigurationLanguageModel
@{
    var items = new List<SelectListItem>();

    var all = ((IEWCultureService)EWServiceProviderManager.ServiceProvider.GetService(typeof(IEWCultureService))).All.OrderBy(m => m.Culture.Name);

    foreach (var item in all)
    {
        var culture = item.Culture;
        items.Add(new SelectListItem()
        {
            Text = string.Format("{0} ({1})", culture.DisplayName, culture.NativeName),
            Value = culture.Name,
            Selected = StringComparer.OrdinalIgnoreCase.Compare(culture.Name, Model.Value.DefaultLanguage) == 0
        });
    }
}
<div class="easyweb-ewdefaultlanguage">
    <div>
        @Html.LabelFor(m => m.Value.UseDefault, EWWebResources.Configuration_Language_Default)
        @Html.CheckBoxFor(m => m.Value.UseDefault)
    </div>
    <div>
        @Html.LabelFor(m => m.Value.UseBrowserSetting, EWWebResources.Configuration_Language_Client)
        @Html.CheckBoxFor(m => m.Value.UseBrowserSetting)
        <span>@EWWebResources.Configuration_Language_Or</span>
        @Html.DropDownListFor(m => m.Value.DefaultLanguage, items)
    </div>
    @Html.ValidationMessageFor(m => m.Value)
    @Html.HiddenFor(m => m.Timestamp)
</div>